/**
 * Company : Thai Informatic System Co., Ltd.
 * Created By : Dr.Tree
 * Created On : Apr 10, 2012  3:42:11 PM 
 * e-Mail : chatree@tis.co.th
 * Mobile Phone : (+66) 087-921-5115
 * Package Name : jpa.service.promis.sales
 * File Name : VwSyncMktCardDeducRequServices.java
 * TODO
 */
package jpa.service.promis.sales;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.persistence.EntityManager;
import org.apache.log4j.Logger;

import jpa.entitys.promis.sales.VwSyncMktBankDeduRequ;
import jpa.entitys.promis.sales.VwSyncMktCardDeducRequ;
import jpa.service.common.JPAService;

/**
 * @author chatree
 *
 */
public class VwSyncMktCardDeducRequServices extends JPAService {
	
	
	private static final Logger log = Logger
			.getLogger(VwSyncMktCardDeducRequServices.class);

	/**
	 * @param em
	 */
	public VwSyncMktCardDeducRequServices(EntityManager em) {
		super(em);
		// TODO Auto-generated constructor stub
	}
	
	public VwSyncMktCardDeducRequ findById(String id) throws Exception {
		
		return super.ConvertToYoureObject(super.find(id, "VwSyncMktCardDeducRequ.findById"));				
	}
	
	public List<VwSyncMktCardDeducRequ> findByDocumentNo(String company,  String project, String documentNo, String status, String syncIsstaging) throws Exception {
		Map<String,Object> mapWhereValue = new HashMap<String, Object>();				
		mapWhereValue.put("company", company);
		mapWhereValue.put("project", project);		
		mapWhereValue.put("documentNo", documentNo);
		mapWhereValue.put("status", status);
		mapWhereValue.put("syncIsstaging", syncIsstaging);
		
		return super.ConvertToYoureObject(super.find("VwSyncMktCardDeducRequ.findByDocumentNo", mapWhereValue));				
	}
	
	public List<VwSyncMktCardDeducRequ> findByContractNo(String company,  String project, String contractNo, String status, String syncIsstaging) throws Exception {
		Map<String,Object> mapWhereValue = new HashMap<String, Object>();
		mapWhereValue.put("company", company);							//log.info("company : " + company);
		mapWhereValue.put("project", project);							//log.info("project : " + project);
		mapWhereValue.put("contractNo", contractNo);					//log.info("contractNo : " + contractNo);
		mapWhereValue.put("status", status);							//log.info("status : " + status);
		mapWhereValue.put("syncIsstaging", syncIsstaging);				//log.info("syncIsstaging : " + syncIsstaging);
		
		return super.ConvertToYoureObject(super.find("VwSyncMktCardDeducRequ.findByContractNo", mapWhereValue));				
	}

}
